home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / BlitzList / BlitzListFiles / BlitzC2P.lha / programming / blitz2 / programs / c2p030.ascii < prev    next >
Encoding:
Text File  |  1998-07-27  |  7.0 KB  |  481 lines

  1. WBStartup
  2. NoCli
  3.  
  4. ; 040/25 results:
  5.  
  6. ; 320x200 @42fps DoublePAL or 44fps PAL
  7. ; 320x256 @31fps DoublePAL or 34fps PAL
  8. ; 320x240 @33.6fps DoublePAL or 36.5fps PAL
  9.  
  10. #c2pBPLX=320
  11. #c2pBPLY=256
  12. #c2pBPLSIZE=(#c2pBPLX*#c2pBPLY)/8
  13.  
  14. #scrwidth=#c2pBPLX
  15. #scrheight=#c2pBPLY
  16. #screensize=#scrwidth*#scrheight
  17.  
  18. ; c2p1x1_8_c5
  19. ;
  20. ; 132% on 040-25
  21.  
  22. Statement c2p030init{A.l,B.l}
  23.  
  24.   ;A.l=d0=Width.w
  25.   ;B.l=d1=Height.w
  26.  
  27. ; d0.w  chunkyx [chunky-pixels]
  28. ; d1.w  chunkyy [chunky-pixels]
  29. ; d2.w  (scroffsx) [screen-pixels]
  30. ; d3.w  scroffsy [screen-pixels]
  31. ; d4.w  (rowlen) [bytes] -- offset between one row and the next in a bpl
  32. ; d5.l  (c2pBPLSIZE) [bytes] -- offset between one row in one bpl and the next bpl
  33.  
  34.   MOVEQ.l #0,d2
  35.   MOVEQ.l #0,d3
  36.   MOVE.l  #c2pBPLX/8,d4
  37.   MOVE.l  d4,d5
  38.   MULU    d1,d5
  39.  
  40.   LEA c2p_datanew(pc),a0
  41.   ANDI.l  #$ffff,d0
  42.   MULU.w  d0,d3
  43.   LSR.l #3,d3
  44.   MOVE.l  d3,c2p_scroffs-c2p_data(a0)
  45.   MULU.w  d0,d1
  46.   MOVE.l  d1,c2p_pixels-c2p_data(a0)
  47. AsmExit
  48. End Statement
  49.  
  50. Statement c2p030{A.l,B.l}
  51.  
  52.   MOVE.l  d0,a0 ; Chunky
  53.   MOVE.l  d1,a1 ; Planar
  54.  
  55. ; a0  c2pscreen
  56. ; a1  bitplanes
  57.  
  58. c2p1x1_8_c5
  59.   MOVEM.l a2-a6,-(a7)
  60.  
  61.   MOVEM.l a0-a1,-(a7)
  62.   LEA c2p_datanew,a0
  63.   LEA c2p_data,a1
  64.   MOVEQ #16-1,d0
  65. _copy: MOVE.l  (a0)+,(a1)+
  66.   DBF d0,_copy
  67.   MOVEM.l (a7)+,a0-a1
  68.  
  69.   LEA c2p_data(pc),a2
  70.  
  71.   MOVE.l  #$33333333,d5
  72.   MOVE.l  #$55555555,d6
  73.   MOVE.l  #$00ff00ff,a6
  74.  
  75.   ADD.w #c2pBPLSIZE,a1
  76.   ADD.l c2p_scroffs-c2p_data(a2),a1
  77.  
  78.   MOVE.l  c2p_pixels-c2p_data(a2),a2
  79.   ADD.l a0,a2
  80.   CMP.l a0,a2
  81.   BEQ _none
  82.  
  83.   MOVEM.l a0-a1,-(a7)
  84.  
  85.   MOVE.l  (a0)+,d0
  86.   MOVE.l  (a0)+,d2
  87.   MOVE.l  (a0)+,d1
  88.   MOVE.l  (a0)+,d3
  89.  
  90.   MOVE.l  #$0f0f0f0f,d4   ; Merge 4x1, part 1
  91.   AND.l d4,d0
  92.   AND.l d4,d2
  93.   LSL.l #4,d0
  94.   OR.l  d2,d0
  95.  
  96.   AND.l d4,d1
  97.   AND.l d4,d3
  98.   LSL.l #4,d1
  99.   OR.l  d3,d1
  100.  
  101.   MOVE.l  d1,a3
  102.  
  103.   MOVE.l  (a0)+,d2
  104.   MOVE.l  (a0)+,d1
  105.   MOVE.l  (a0)+,d3
  106.   MOVE.l  (a0)+,d7
  107.  
  108.   AND.l d4,d2     ; Merge 4x1, part 2
  109.   AND.l d4,d1
  110.   LSL.l #4,d2
  111.   OR.l  d1,d2
  112.  
  113.   AND.l d4,d3
  114.   AND.l d4,d7
  115.   LSL.l #4,d3
  116.   OR.l  d7,d3
  117.  
  118.   MOVE.l  a3,d1
  119.  
  120.   MOVE.w  d2,d7     ; Swap 16x2
  121.   MOVE.w  d0,d2
  122.   SWAP  d2
  123.   MOVE.w  d2,d0
  124.   MOVE.w  d7,d2
  125.  
  126.   MOVE.w  d3,d7
  127.   MOVE.w  d1,d3
  128.   SWAP  d3
  129.   MOVE.w  d3,d1
  130.   MOVE.w  d7,d3
  131.  
  132.   BRA _start1
  133. _x1
  134.   MOVE.l  (a0)+,d0
  135.   MOVE.l  (a0)+,d2
  136.   MOVE.l  (a0)+,d1
  137.   MOVE.l  (a0)+,d3
  138.  
  139.   MOVE.l  d7,c2pBPLSIZE(a1)
  140.  
  141.   MOVE.l  #$0f0f0f0f,d4   ; Merge 4x1, part 1
  142.   AND.l d4,d0
  143.   AND.l d4,d2
  144.   LSL.l #4,d0
  145.   OR.l  d2,d0
  146.  
  147.   AND.l d4,d1
  148.   AND.l d4,d3
  149.   LSL.l #4,d1
  150.   OR.l  d3,d1
  151.  
  152.   MOVE.l  d1,a3
  153.  
  154.   MOVE.l  (a0)+,d2
  155.   MOVE.l  (a0)+,d1
  156.   MOVE.l  (a0)+,d3
  157.   MOVE.l  (a0)+,d7
  158.  
  159.   MOVE.l  a4,(a1)+
  160.  
  161.   AND.l d4,d2     ; Merge 4x1, part 2
  162.   AND.l d4,d1
  163.   LSL.l #4,d2
  164.   OR.l  d1,d2
  165.  
  166.   AND.l d4,d3
  167.   AND.l d4,d7
  168.   LSL.l #4,d3
  169.   OR.l  d7,d3
  170.  
  171.   MOVE.l  a3,d1
  172.  
  173.   MOVE.w  d2,d7     ; Swap 16x2
  174.   MOVE.w  d0,d2
  175.   SWAP  d2
  176.   MOVE.w  d2,d0
  177.   MOVE.w  d7,d2
  178.  
  179.   MOVE.w  d3,d7
  180.   MOVE.w  d1,d3
  181.   SWAP  d3
  182.   MOVE.w  d3,d1
  183.   MOVE.w  d7,d3
  184.  
  185.   MOVE.l  a5,-c2pBPLSIZE-4(a1)
  186. _start1
  187.   MOVE.l  a6,d4
  188.  
  189.   MOVE.l  d2,d7     ; Swap 2x2
  190.   LSR.l #2,d7
  191.   EOR.l d0,d7
  192.   AND.l d5,d7
  193.   EOR.l d7,d0
  194.   LSL.l #2,d7
  195.   EOR.l d7,d2
  196.  
  197.   MOVE.l  d3,d7
  198.   LSR.l #2,d7
  199.   EOR.l d1,d7
  200.   AND.l d5,d7
  201.   EOR.l d7,d1
  202.   LSL.l #2,d7
  203.   EOR.l d7,d3
  204.  
  205.   MOVE.l  d1,d7
  206.   LSR.l #8,d7
  207.   EOR.l d0,d7
  208.   AND.l d4,d7
  209.   EOR.l d7,d0
  210.   LSL.l #8,d7
  211.   EOR.l d7,d1
  212.  
  213.   MOVE.l  d1,d7
  214.   LSR.l #1,d7
  215.   EOR.l d0,d7
  216.   AND.l d6,d7
  217.   EOR.l d7,d0
  218.   MOVE.l  d0,c2pBPLSIZE*2(a1)
  219.   ADD.l d7,d7
  220.   EOR.l d1,d7
  221.  
  222.   MOVE.l  d3,d1
  223.   LSR.l #8,d1
  224.   EOR.l d2,d1
  225.   AND.l d4,d1
  226.   EOR.l d1,d2
  227.   LSL.l #8,d1
  228.   EOR.l d1,d3
  229.  
  230.   MOVE.l  d3,d1
  231.   LSR.l #1,d1
  232.   EOR.l d2,d1
  233.   AND.l d6,d1
  234.   EOR.l d1,d2
  235.   ADD.l d1,d1
  236.   EOR.l d1,d3
  237.  
  238.   MOVE.l  d2,a4
  239.   MOVE.l  d3,a5
  240.  
  241.   CMPA.l  a0,a2
  242.   BNE _x1
  243.  
  244.   MOVE.l  d7,c2pBPLSIZE(a1)
  245.   MOVE.l  a4,(a1)+
  246.   MOVE.l  a5,-c2pBPLSIZE-4(a1)
  247.  
  248.   MOVEM.l (a7)+,a0-a1
  249.   ADD.l #c2pBPLSIZE*4,a1
  250.  
  251.   MOVE.l  (a0)+,d0
  252.   MOVE.l  (a0)+,d2
  253.   MOVE.l  (a0)+,d1
  254.   MOVE.l  (a0)+,d3
  255.  
  256.   MOVE.l  #$f0f0f0f0,d4   ; Merge 4x1, part 1
  257.   AND.l d4,d0
  258.   AND.l d4,d2
  259.   LSR.l #4,d2
  260.   OR.l  d2,d0
  261.  
  262.   AND.l d4,d1
  263.   AND.l d4,d3
  264.   LSR.l #4,d3
  265.   OR.l  d3,d1
  266.  
  267.   MOVE.l  d1,a3
  268.  
  269.   MOVE.l  (a0)+,d2
  270.   MOVE.l  (a0)+,d1
  271.   MOVE.l  (a0)+,d3
  272.   MOVE.l  (a0)+,d7
  273.  
  274.   AND.l d4,d2     ; Merge 4x1, part 2
  275.   AND.l d4,d1
  276.   LSR.l #4,d1
  277.   OR.l  d1,d2
  278.  
  279.   AND.l d4,d3
  280.   AND.l d4,d7
  281.   LSR.l #4,d7
  282.   OR.l  d7,d3
  283.  
  284.   MOVE.l  a3,d1
  285.  
  286.   MOVE.w  d2,d7     ; Swap 16x2
  287.   MOVE.w  d0,d2
  288.   SWAP  d2
  289.   MOVE.w  d2,d0
  290.   MOVE.w  d7,d2
  291.  
  292.   MOVE.w  d3,d7
  293.   MOVE.w  d1,d3
  294.   SWAP  d3
  295.   MOVE.w  d3,d1
  296.   MOVE.w  d7,d3
  297.  
  298.   BRA _start2
  299. _x2
  300.   MOVE.l  (a0)+,d0
  301.   MOVE.l  (a0)+,d2
  302.   MOVE.l  (a0)+,d1
  303.   MOVE.l  (a0)+,d3
  304.  
  305.   MOVE.l  d7,c2pBPLSIZE(a1)
  306.  
  307.   MOVE.l  #$f0f0f0f0,d4   ; Merge 4x1, part 1
  308.   AND.l d4,d0
  309.   AND.l d4,d2
  310.   LSR.l #4,d2
  311.   OR.l  d2,d0
  312.  
  313.   AND.l d4,d1
  314.   AND.l d4,d3
  315.   LSR.l #4,d3
  316.   OR.l  d3,d1
  317.  
  318.   MOVE.l  d1,a3
  319.  
  320.   MOVE.l  (a0)+,d2
  321.   MOVE.l  (a0)+,d1
  322.   MOVE.l  (a0)+,d3
  323.   MOVE.l  (a0)+,d7
  324.  
  325.   MOVE.l  a4,(a1)+
  326.  
  327.   AND.l d4,d2     ; Merge 4x1, part 2
  328.   AND.l d4,d1
  329.   LSR.l #4,d1
  330.   OR.l  d1,d2
  331.  
  332.   AND.l d4,d3
  333.   AND.l d4,d7
  334.   LSR.l #4,d7
  335.   OR.l  d7,d3
  336.  
  337.   MOVE.l  a3,d1
  338.  
  339.   MOVE.w  d2,d7     ; Swap 16x2
  340.   MOVE.w  d0,d2
  341.   SWAP  d2
  342.   MOVE.w  d2,d0
  343.   MOVE.w  d7,d2
  344.  
  345.   MOVE.w  d3,d7
  346.   MOVE.w  d1,d3
  347.   SWAP  d3
  348.   MOVE.w  d3,d1
  349.   MOVE.w  d7,d3
  350.  
  351.   MOVE.l  a5,-c2pBPLSIZE-4(a1)
  352. _start2
  353.   MOVE.l  a6,d4
  354.  
  355.   MOVE.l  d2,d7     ; Swap 2x2
  356.   LSR.l #2,d7
  357.   EOR.l d0,d7
  358.   AND.l d5,d7
  359.   EOR.l d7,d0
  360.   LSL.l #2,d7
  361.   EOR.l d7,d2
  362.  
  363.   MOVE.l  d3,d7
  364.   LSR.l #2,d7
  365.   EOR.l d1,d7
  366.   AND.l d5,d7
  367.   EOR.l d7,d1
  368.   LSL.l #2,d7
  369.   EOR.l d7,d3
  370.  
  371.   MOVE.l  d1,d7
  372.   LSR.l #8,d7
  373.   EOR.l d0,d7
  374.   AND.l d4,d7
  375.   EOR.l d7,d0
  376.   LSL.l #8,d7
  377.   EOR.l d7,d1
  378.  
  379.   MOVE.l  d1,d7
  380.   LSR.l #1,d7
  381.   EOR.l d0,d7
  382.   AND.l d6,d7
  383.   EOR.l d7,d0
  384.   MOVE.l  d0,c2pBPLSIZE*2(a1)
  385.   ADD.l d7,d7
  386.   EOR.l d1,d7
  387.  
  388.   MOVE.l  d3,d1
  389.   LSR.l #8,d1
  390.   EOR.l d2,d1
  391.   AND.l d4,d1
  392.   EOR.l d1,d2
  393.   LSL.l #8,d1
  394.   EOR.l d1,d3
  395.  
  396.   MOVE.l  d3,d1
  397.   LSR.l #1,d1
  398.   EOR.l d2,d1
  399.   AND.l d6,d1
  400.   EOR.l d1,d2
  401.   ADD.l d1,d1
  402.   EOR.l d1,d3
  403.  
  404.   MOVE.l  d2,a4
  405.   MOVE.l  d3,a5
  406.  
  407.   CMPA.l  a0,a2
  408.   BNE _x2
  409.  
  410.   MOVE.l  d7,c2pBPLSIZE(a1)
  411.   MOVE.l  a4,(a1)+
  412.   MOVE.l  a5,-c2pBPLSIZE-4(a1)
  413.  
  414. _none
  415.   MOVEM.l (a7)+,a2-a6
  416. AsmExit
  417.  
  418.   Even4
  419. c2p_data
  420. c2p_scroffs: Dc.l 0
  421. c2p_pixels: Dc.l 0
  422.   Ds.l  16
  423.   Even4
  424. c2p_datanew
  425.   Ds.l  16
  426. End Statement
  427.  
  428.  
  429.  
  430.  
  431. .blitzprogram
  432. ; Setup
  433. InitBank 0,(#scrwidth*#scrheight)+1000,2|65536 ; Chipram planar buffer
  434. CludgeBitMap 0,#scrwidth,#scrheight,8,Bank(0)
  435. InitPalette 0,256
  436. For c=0 To 255
  437.   AGAPalRGB 0,c,Rnd(c),Rnd(c),Rnd(c)
  438. Next c
  439. AGAPalRGB 0,0,0,0,0
  440. Screen 0,0,0,#scrwidth,#scrheight,8,0,"c2p test",0,0,0
  441. Use Palette 0
  442. VWait 50
  443. baseaddress1.l=AllocMem(#scrwidth*#scrheight,$10000) ; Fastram chunky buffer
  444.  
  445. ; Put something into the chunky buffer so we can see it working
  446. GetReg a0,baseaddress1
  447. MOVE.l  #0,d0
  448. MOVE.l  #screensize-1,d1
  449. cloop
  450.   MOVE.b  d0,(a0)+
  451.   ADDQ.l  #1,d0
  452.   SUBQ.l  #1,d1
  453.   TST.l   d1
  454.   BLT     done
  455.   BRA     cloop
  456. done
  457.  
  458. ; Do the c2p test
  459. c2p030init{#scrwidth,#scrheight}
  460. VWait 20
  461. Forbid_
  462. VWait
  463. ResetTimer
  464. For time=1 To 800
  465.   c2p030{baseaddress1,Bank(0)} ; Convert chunky to planar
  466. Next time
  467. t=Ticks
  468. VWait 2 : Permit_
  469. VWait 20
  470. FindScreen 0
  471. Window 0,0,11,640,100,0,"Test results for c2p",0,0
  472. WindowOutput 0
  473. NPrint "Routine performed @ ",50/(t/800),"fps - ",t," ticks"
  474. NPrint " "
  475. NPrint "Press mousebutton..."
  476. Free Screen 0
  477. MouseWait
  478. Free Window 0
  479. End
  480.  
  481.